package com.metaera.app.ui.activities;

import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.metaera.app.R;
import com.metaera.app.controller.core.IPaginationPresenter;
import com.metaera.app.controller.core.SimplePaginationPresenter;
import com.metaera.app.controller.view.core.IPaginationView;
import com.metaera.app.data.DataRepository;
import com.metaera.app.data.model.BasicListResponse;
import com.metaera.app.data.model.HotColumnResponse;
import com.metaera.app.data.network.ApiParam;
import com.metaera.app.ui.adapters.HotColumnAdapter;
import com.metaera.app.ui.core.BaseRequestListActivity;

import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.Observable;

/**
 * 热门专栏
 */
public class HotColumnListActivity extends BaseRequestListActivity<HotColumnResponse> {

    @Override
    protected String getActivityTitle() {
        return getString(R.string.hot_column);
    }

    @Override
    protected BaseQuickAdapter<HotColumnResponse, BaseViewHolder> createAdapter(RecyclerView recyclerView) {
        recyclerView.setBackgroundColor(Color.WHITE);
        return new HotColumnAdapter();
    }

    @Override
    protected IPaginationPresenter<IPaginationView<HotColumnResponse>, HotColumnResponse> createPresenter() {
        return new SimplePaginationPresenter<HotColumnResponse>() {
            @Override
            protected Observable<BasicListResponse<HotColumnResponse>> execute() {
                return  DataRepository.getInstance().getPopularColumn(ApiParam.COLUMN_TYPE, mPage, ApiParam.PAGE_SIZE);
            }
        };
    }

}
